package com.tjetc.utils;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionManager;

import java.io.IOException;

public class Db {
    private static SqlSessionManager sqlSessionManager;

    static {
        try {
            sqlSessionManager = SqlSessionManager.newInstance(Resources.getResourceAsReader("mybatis.xml"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static<T> T getMapper(Class<T> clz){
        return sqlSessionManager.getMapper(clz);
    }
}
